Display of numeric variable values
By default, numeric variable values are displayed to their full calculated precision.
var | value display |
---|---|
pi | 3.14159... |
2 | 2 |
Round (pi, -4) | 3.1416 |
sigdig (1234.5, 3) | 1230 |
1.001 | 1.001 |
You can override the format displayed by using add @format in the last column of the variable definition table. For example, to change the display of the number 1234.5:
Format | Display | Meaning |
---|---|---|
# | 1235 | Integer format. Rounds the value to the nearest integer. |
#. | 1235. | Integer format with trailing decimal point. |
#.# | 1234.5 | Floating point with 2 digits of precision. Additional digits of precision are added by providing more pound signs to the right of the decimal. For example, #.## produces 1234.50. |
#.##E+00 | 1.23*10^03 | Scientific notation (same rules for digits of precision as for floating point, described above). The E+00 portion specifies the minimum number of digits for the exponent. To increase the number of exponent digits, add more zeros (for example, E+000). |
{2} | 1200 | Round and display to 2 significant figures, using loose significant figure conventions. (Information about loose sigfig conventions is provided below.) |
[2] | 1.2*10^3 | Round and display to 2 significant figures, using tight significant figure conventions. (Information about tight sigfig conventions is provided below.) |
[2.] | 1.2*10^3 | See also information about trailing-dot notation below. |
Important: Changing the display format for numeric variable values does not round the answer. For example, if the variable value is 12345 and the format is {3}, the value displayed is 12300 even though the value used in calculations or to evaluate the answer is still 12345.
Loose and tight significant figure conventions
In the following example:
- V is a value expressed as a decimal (e.g., 12345.6789).
- L is the number of digits in V to the left of the decimal place.
- R is the number to the right of the decimal place.
- N is the number of significant digits.
Loose sigfig conventions
Round V to N significant figures. Call this V_r.
If ... | Then ... |
---|---|
V_r > 10000 or V_r < 0.1 | Express V_r in scientific notation with 1 digit left of the decimal and N-1 digits right of the decimal. If N = 1, do not include the decimal point. |
1 > V_r >= 0.1 | Display as zero+decimal point+N digits right of the decimal point. |
N > L | Display all digits to the left of the decimal, a decimal point, and N-L right of the decimal. |
N <= L | Display as an integer without any decimal point. |
- Using loose conventions, 200 is displayed as 200 to 1, 2, or 3 sigfigs.
Tight sigfig conventions without trailing-dot notation
Round V to N significant figures. Call this V_r.
If ... | Then ... |
---|---|
V_r > 10000 or V_r < 0.1 | Express V in scientific notation with 1 digit left of the decimal and N-1 digits right of the decimal. If N = 1, do not include the decimal point. |
1 > V_r >= 0.1 | Display as zero+decimal point+N digits right of the decimal point. |
N > L | Display all digits to the left of the decimal, a decimal point, and N-L right of the decimal. |
N = L, and the right-most digit before the decimal is not zero | Display as an integer. |
N = L, and right-most digit before the decimal is zero | Display using scientific notation. |
N < L | Display using scientific notation with 1 digit left of the decimal and N-1 digits right of the decimal |
N < L and N = 1 | Display using scientific notation. Do not include the decimal point |
Using tight conventions without trailing-dot notation:
- 1 significant figure – 200
- 2 significant figures – 2.0*10^2
- 3 significant figures – 2.00*10^2
Tight sigfig conventions with trailing dot-notation
These are the same as tight without trailing dot except for the last row:
If ... | Then ... |
---|---|
N = L, and the last digit is zero | Display as an integer and add a decimal point at the end. |
Using tight conventions with trailing dot notation, 200 is displayed as:
- 1 significant figure – 200
- 2 significant figures – 2.0*10^2
- 3 significant figures – 200. (includes the period)
See also: